Simple harmonic oscillator
Newtonian mechanics
The simple harmonic oscillator (SHM from now on) is a system of a point particle with a linear force, of the form
\begin{equation} m \ddot{\vec{x}}(t) = - k \vec{x}(t) \end{equation}With $k$ the elasticity coefficient of the system. There are a few ways of writing the solution, all equivalent. First we can define them as trigonometric functions :
\begin{eqnarray} \vec{x}(t) &=& \vec{A} \sin(\omega t) + \vec{B} \cos(\omega t)\\ \dot{\vec{x}}(t) &=& \vec{A} \omega \cos(\omega t) - \vec{B} \omega \sin(\omega t)\\ \ddot{\vec{x}}(t) &=& -\omega^2 (\vec{A} \sin(\omega t) - \vec{B} \cos(\omega t))\\ &=& -\omega^2 \vec{x}(t) \end{eqnarray}This means that $\omega = \sqrt{k/m}$.
Using boundary conditions, we get
\begin{eqnarray} \vec{x}(0) &=& \vec{B}\\ \dot{\vec{x}}(0) &=& \vec{A} \omega \end{eqnarray}So that $B = x_0$ and $A = v_0 / \omega$.
Another common set of solutions for this equation is the complex solution
\begin{eqnarray} \vec{x}(t) &=& A e^{i \omega t} + B e^{-i \omega t}\\ \dot{\vec{x}}(t) &=& i\omega (A e^{i \omega t} + B e^{-i \omega t}) \end{eqnarray}which will be fine as long as the resulting quantities are all real. Given our boundary conditions, we have
\begin{eqnarray} \vec{x}(0) &=& A - B\\ \dot{\vec{x}}(0) &=& \end{eqnarray}Lagrangian mechanics
\begin{equation} L = \frac{m}{2} \dot{\vec{x}}(t) \cdot \dot{\vec{x}}(t) - \frac{k}{2} \vec{x}(t) \cdot \vec{x}(t) \end{equation}Euler-Lagrange :
\begin{eqnarray} \frac{\partial L}{\partial \vec{x}} &=& - k \vec{x}\\ \frac{\partial L}{\partial \dot{\vec{x}}} &=& m \dot{\vec{x}} \end{eqnarray} \begin{equation} -k \vec{x}(t) - m \ddot{\vec{x}}(t) = 0 \end{equation} \begin{equation} m \ddot{\vec{x}}(t) = - k \vec{x}(t) \end{equation}Hamiltonian mechanics
Momentum :
\begin{equation} \vec{p} = m \dot{x}(t) \end{equation}Inverse :
\begin{equation} \vec{v}(\vec{p}) = \frac{\vec{p}(t)}{m} \end{equation}Hamiltonian :
\begin{eqnarray} H &=& \vec{v}(\vec{p}) \vec{p}(t) - \frac{m}{2} \vec{v}(t) \cdot \vec{v}(t) + \frac{k}{2} \vec{x}(t) \cdot \vec{x}(t)\\ &=& \frac{\vec{p}(t) \cdot \vec{p}(t)}{2m} + \frac{k}{2} \vec{x}(t) \cdot \vec{x}(t) \end{eqnarray}Equations of motion :
\begin{eqnarray} \dot{\vec{x}}(t) &=& \frac{\partial H}{\partial \vec{p}}\\ &=& \frac{\vec{p}}{2}\\ \dot{\vec{p}}(t) &=& - \frac{\partial H}{\partial \vec{x}}\\ &=& - k \vec{x}(t) \end{eqnarray}We end up with our original equation of motion,
\begin{equation} \ddot{\vec{x}}(t) = - k \vec{x}(t) \end{equation}with the same solutions.
An important set of coordinates we'll have to use later on is a
\begin{eqnarray} \vec{a}(t) &=& \sqrt{\frac{m\omega}{2}}(\vec{x}(t) + \frac{i}{m\omega} \vec{p}(t))\\ \vec{a}^\dagger(t) &=& \sqrt{\frac{m\omega}{2}}(\vec{x}(t) - \frac{i}{m\omega} \vec{p}(t)) \end{eqnarray}The inverse transformation being
\begin{eqnarray} x(t) &=& \sqrt{\frac{1}{2m\omega}} (\vec{a}(t) + \vec{a}^\dagger(t))\\ p(t) &=& i\frac{\sqrt{m\omega}}{2}(\vec{a}^\dagger(t) - \vec{a}(t)) \end{eqnarray} \begin{eqnarray} H &=& \frac{\vec{p}(t) \cdot \vec{p}(t)}{2m} + k \vec{x}(t) \cdot \vec{x}(t)\\ &=& -\frac{m\omega}{4m} (\vec{a}^\dagger(t) - \vec{a}(t)) \cdot (\vec{a}^\dagger(t) - \vec{a}(t)) + \frac{k}{2m\omega} (\vec{a}(t) + \vec{a}^\dagger(t)) \cdot (\vec{a}(t) + \vec{a}^\dagger(t)) \end{eqnarray}Non-relativistic quantum mechanics
As far as the Poisson brackets go, not much has changed compared to the free particle case, so we have our usual
\begin{equation} [\hat{x}_i, \hat{p}_j] = i\hbar \delta_{ij} \hat{I} \end{equation}The Hamiltonian will change, though, and we'll get instead
\begin{eqnarray} H &=& \frac{\hat{\vec{p}}(t) \cdot \hat{\vec{p}}(t)}{2m} + k \hat{\vec{x}}(t) \cdot \hat{\vec{x}}(t)\\ &=& - \frac{\hbar^2}{2m} \Delta + k \| x \|^2 \end{eqnarray}The Schrödinger equation must therefore obey
\begin{equation} i \hbar \frac{\partial}{\partial t} \psi(t, _vec{x}) = - \frac{\hbar^2}{2m} \Delta \psi(t, \vec{x}) + k \| x \|^2 \psi(t, \vec{x}) \end{equation}We are in luck since there exists a basis of our Hilbert space $L^2(\mathbb{R}^n, d\mu)$ that is an eigenvector of this operator, the Hermite functions.
\begin{equation} \psi_n(\vec{x}) = (-1)^n (2^n n! \sqrt{\pi})^{-\frac{1}{2}} e^{\frac{\|\vec{x}\|^2}{2}} \frac{\partial^n}{\partial \vec{x}} e^{\|\vec{x}\|^2} \end{equation}...
It is also possible to solve this system without referring to any specific wavefunction. Consider our ladder operators,
\begin{eqnarray} \hat{a} &=& \sqrt{\frac{m \omega}{2 \hbar}} (\hat{x} + \frac{i}{m \omega} \hat{p})\\ \hat{a}^\dagger &=& \sqrt{\frac{m \omega}{2 \hbar}} (\hat{x} - \frac{i}{m \omega} \hat{p}) \end{eqnarray}